import Vue from "vue";
import App from "./App.vue";

import router from "./router/index";
import store from "./store/index";

//global filters
import filters from "./filter/index";

Object.keys(filters).map(filter => {
  Vue.filter(filter, filters[filter]);
  Vue.prototype[filter] = filters[filter];
});

//global directives
import directives from "./directive/index";

Object.keys(directives).map(directive => {
  Vue.directive(directive, directives[directive]);
});

//ElementUI
import ElementUI from "element-ui";

Vue.use(ElementUI);

//echart
import echarts from "echarts";

Vue.prototype.$echarts = echarts;

//global component
import GlobalComponent from "./components/globalComponent";

Vue.use(GlobalComponent);

//axios
import service from "@/axios/axios";

Vue.prototype.axios = service;

//global function
import globalFunction from "./utils/function";

Object.keys(globalFunction).map(
  key => (Vue.prototype[key] = globalFunction[key])
);

//API
import api from "./api/index";

Vue.prototype.api = api;

//Ali OSS
import ali_oss from "./utils/oss";
Vue.use(ali_oss);

Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
